import requests
from config import url_cloud,headers_web

class LaboratoryAdmittance:
    def __int__(self):
        self.url = url_cloud
        self.headers = headers_web
    @classmethod
    def get_admittances(cls,url_cloud: str,headers= headers_web,params= None):
        '''
        summary:"1.获取实验室准入规则"
        description:"1.云课堂管理端"
        :param url:
        :param headers:
        :param params:
        :return:
        '''
        url = url_cloud + "/teachinglaboratoryapi/v1/laboratoryadmittances"
        r = requests.get(url= url, headers= headers,params= params)
        return r
    @classmethod
    def post_admittances(cls,url_cloud: str,headers= headers_web,params= None,json= None):
        '''
        summary:"1.保存实验室准入规则"
        description:"1.云课堂管理端"
        :param url_cloud:
        :param headers:
        :param params:
        :param json:
        :return:
        '''
        url = url_cloud + "/teachinglaboratoryapi/v1/laboratoryadmittances"
        r = requests.post(url= url,headers= headers,params= params,json= json)
        return r

    @classmethod
    def get_checkadmittance(cls,url_cloud: str, headers= headers_web, params= None):
        '''
        summary:1.校验学生实验室准入规则对应内容是否完成
        description:"1.云课堂管理端"
        :param url:
        :param headers:
        :param params:
        :return:
        '''
        url = url_cloud + "/teachinglaboratoryapi/v1/laboratoryadmittances/checklaboratoryadmittance"
        r = requests.get(url = url, headers= headers,params= params)
        return r

    @classmethod
    def post_admittancestatus(cls,url_cloud: str,headers= headers_web,params= None,json= None,paramspath = None):
        '''
        summary:更新实验室准入规则状态
        description:"1.云课堂管理端"
        :param url:
        :param headers:
        :param params:
        :param json:
        :return:
        '''
        url = url_cloud + f"/teachinglaboratoryapi/v1/laboratoryadmittances/{paramspath}/status"
        r = requests.post(url= url, headers=headers,params= params,json= json)
        return r

    @classmethod
    def get_learningoverview(cls,url_cloud: str,headers= headers_web,params= None,paramspath = None):
        '''
        summary:查看学生学习实验室准入规则情况
        description:"1.云课堂管理端"
        :param url_cloud:
        :param headers:
        :param params:
        :param paramspath:
        :return:
        '''
        url = url_cloud + f"/teachinglaboratoryapi/v1/laboratoryadmittances/{paramspath}/learningoverview"
        r = requests.get(url = url, headers= headers,params= params)
        return r